//
//  XBNavigationController.m
//  shiLeChlorella
//
//  Created by HX on 2017/7/20.
//  Copyright © 2017年 TXB. All rights reserved.
//

#import "XBNavigationController.h"

@interface XBNavigationController ()<UIGestureRecognizerDelegate>

@end

@implementation XBNavigationController



- (void)viewDidLoad
{
     [super viewDidLoad];
     [self setupNavBarTheme];
//          //添加全屏返回手势
//     [self addFullScreenPopGes];
 

}

/*
 *  添加全屏返回手势,在不需要的页面可以设置interactivePopGestureRecognizer.enabled属性控制
 */
- (void)addFullScreenPopGes{

     UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self.interactivePopGestureRecognizer.delegate action:@selector(handleNavigationTransition:)];
     pan.delegate = self;
     [self.view addGestureRecognizer:pan];

}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
     if (self.childViewControllers.count > 1 && self.interactivePopGestureRecognizer.enabled) {
          return YES;
     }
     return NO;
}

//#pragma mark 控制状态栏的样式
//- (UIStatusBarStyle)preferredStatusBarStyle
//{
//     return UIStatusBarStyleLightContent;
//}
//
//- (BOOL)shouldAutorotate
//{
//     return NO;
//}
//
//- (UIInterfaceOrientationMask)supportedInterfaceOrientations
//{
//     return UIInterfaceOrientationMaskPortrait;
//}


/**
 *  设置导航栏主题
 */
- (void)setupNavBarTheme
{
     UINavigationBar *navBar = [UINavigationBar appearance];
//     [navBar setBarTintColor:[[UIColor colorWithRed:0/255.0 green:191/255.0 blue:255/255.0 alpha:1.0]  colorWithAlphaComponent:0.8]];
     navBar.tintColor = [UIColor whiteColor];

     
     
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
     if (self.viewControllers.count > 0) {

          viewController.hidesBottomBarWhenPushed = YES;
          
     }
     [super pushViewController:viewController animated:animated];
}

@end
